<template>
  <div class="app-container home">
    <div class="container_top">
      <div class="container_title">云胶片系统数据统计</div>
    </div>

    <div class="grid-content" style="height: 120px;margin-bottom: 16px;">
      <div class="grid-content__box">
        <!-- <div class="grid-content__title">今日核心指标</div> -->
        <div class="grid-content__tip">
          <el-row>
            <el-col :span="5" v-for="(item, index) in cardList" :key="index">
              <div class="tip__title">{{ item.title }}</div>
              <div class="tip__num">{{ item.total }}</div>
            </el-col>
          </el-row>
        </div>
      </div>
    </div>

    <el-row :gutter="8">
      <el-col :xs="24" :sm="8" :md="8" :lg="8" class="my-ul">
        <TipCard title="用户年龄分类">
          <template #chart>
            <chart1 />
          </template>
        </TipCard>
      </el-col>
      <el-col :xs="24" :sm="8" :md="8" :lg="8" class="my-ul">
        <TipCard title="生成报告" :tab="tabList">
          <template #chart="{ currentTab }">
            <chart3 v-if="currentTab === '月'" />
            <chart3_1 v-else-if="currentTab === '年'" />
          </template>
        </TipCard>
      </el-col>
      <el-col :xs="24" :sm="8" :md="8" :lg="8" class="my-ul">
        <TipCard title="浏览云胶片报告人次" :tab="tabList">
          <template #chart="{ currentTab }">
            <chart4_1 v-if="currentTab === '月'" />
            <chart4_2 v-else-if="currentTab === '年'" />
          </template>
        </TipCard>
      </el-col>
    </el-row>
    <el-row :gutter="8">
      <el-col :xs="24" :sm="8" :md="8" :lg="8" class="my-ul">
        <TipCard title="各类检查报告分类汇总" :tab="tabList">
          <template #chart="{ currentTab }">
            <chart5_1 v-if="currentTab === '月'" />
            <chart3_1 v-else-if="currentTab === '年'" />
          </template>
        </TipCard>
      </el-col>
      <el-col :xs="24" :sm="8" :md="8" :lg="8" class="my-ul">
        <TipCard title="分类报告阅读量" :tab="tabList">
          <template #chart="{ currentTab }">
            <chart6_1 v-if="currentTab === '月'" />
            <chart4_2 v-else-if="currentTab === '年'" />
          </template>
        </TipCard>
      </el-col>
      <el-col :xs="24" :sm="8" :md="8" :lg="8" class="my-ul">
        <TipCard title="科室浏览云胶片量" :tab="tabList">
          <template #chart="{ currentTab }">
            <chart7 v-if="currentTab === '月'" />
            <chart4_2 v-else-if="currentTab === '年'" />
          </template>
        </TipCard>
      </el-col>
    </el-row>
  </div>
</template>

<script setup name="Index">
import chart1 from "./components/chart1"
import chart2 from "./components/chart2"
import chart3 from "./components/chart3"
import chart3_1 from "./components/chart3_1"
import chart4_1 from "./components/chart4_1"
import chart4_2 from "./components/chart4_2"
import chart4 from "./components/chart4"
import chart5_1 from "./components/chart5_1"
import chart6_1 from "./components/chart6_1"
import chart7 from "./components/chart7"
import TipCard from "./components/tipCard"

// const currentTab = reactive({})

const tabList = reactive([
  { value: "月" },
  { value: "年" },
])

const cardList = reactive([
  {
    title: '检查人数统计',
    num: '0.04%',
    total: '122342',
    cardInfo: [
      {
        title: '手术并发症患者发生例数',
        value: '4例',

      },
      {
        title: '出院患者手术人数',
        value: '100人'
      }
    ],
    renderFooter: true,
    buttonName: '情况说明'
  },
  {
    title: '渠道浏览量统计',
    num: '0.05%',
    total: '56743332',
    cardInfo: [
      {
        title: '手术并发症患者发生例数',
        value: '5人数'
      },
      {
        title: '手术台次数',
        value: '100台次'
      }
    ],
    renderFooter: true,
    buttonName: '情况说明'
  },
  {
    title: '云胶片生成数',
    num: '-5%',
    total: '97334673',
    renderHeader: true,
    headerList: [
      { buttonName: '本省数据查看' }
    ],
    cardInfo: [
      {
        title: '病种例数',
        value: '5项'
      },
      {
        title: '住院日数',
        value: '6项'
      },
      {
        title: '次均费用',
        value: '6项'
      }
    ],
    renderFooter: true,
    buttonName: '改进措施'
  },
])

function isPositive(item) {
  return parseFloat(item.replace('%', ''))
}
function formatPercentage(item) {
  return item.replace('-', '')
}
function check() {
  console.log("本省数据查看")
}


</script>

<style lang="scss" scoped>
.app-container {
  padding: 16px 16px;
  clear: both;

  &.home {
    overflow-x: hidden;
    height: 100%;
  }

  .container_top {
    width: 100%;
    height: 48px;
    margin-top: 4px;
    margin-bottom: 12px;
    display: flex;

    .container_title {
      text-align: left;
      font-size: 18px;
      font-weight: 600;
      line-height: 48px;
      flex: 1;
      padding-left: 6px;
    }

    .container_subtitle {
      font-size: 14px;
      line-height: 48px;
      color: #555555;
      padding-right: 6px;

      span {
        padding-left: 24px;
      }
    }
  }

  .my-ul {
    margin-bottom: 8px;

    .card_title {
      font-size: 15px;
      font-weight: 600;
      height: 30px;
      margin-bottom: 18px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding-left: 14px;
      position: relative;

      &:before {
        content: "";
        position: absolute;
        width: 4px;
        height: 12px;
        background: #0783ff;
        left: 0;
        margin: auto;
      }
    }

    .card_detail {
      font-size: 14px;
      display: flex;
      align-items: center;

      .card_d_title {
        flex: 1;
        text-align: left;
        font-weight: 600;
      }

      .card_d_detail {
        flex: 1;
        font-size: 14px;
        font-weight: 600;
        display: flex;
        align-items: flex-start;
        justify-content: flex-end;
      }
    }

    .card_info {
      padding-top: 16px;
      min-height: 94px;

      .card_i {
        display: flex;
        align-items: center;
        font-size: 13px;
        line-height: 26px;

        .card_i_title {
          flex: 1;
          text-align: left;
        }

        .card_i_detail {
          flex: 1;
          text-align: right;
        }
      }
    }

    .card_num {
      font-size: 14px;
      display: flex;
      align-items: center;
      padding-bottom: 12px;

      .card_n_title {
        flex: 1;
        text-align: left;
      }

      .card_n_detail {
        flex: 1;
        text-align: right;
        font-size: 16px;
      }
    }

    .card_btn {
      display: flex;
      margin-top: 12px;
      border-top: 1px solid #e5e5e5;
      padding-top: 12px;
      min-height: 41px;

      .card_btn_left {
        flex: 1;
        text-align: left;
      }

      .card_btn_right {
        flex: 1;
        text-align: right;
      }
    }
  }
}

a.pop_btn {
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
}

.card_more {
  font-size: 13px;
  color: #555555;
  font-weight: 400;
}

.title_content {
  display: flex;
  align-items: baseline;
  font-weight: 600;

  .total_ad {
    font-size: 42px;
    font-family: "Pingfang SC";
    font-weight: 600;
    color: #0783ff;
    padding-right: 4px;
  }

  .total_ed {
    font-size: 20px;
    font-weight: 600;
    padding-left: 4px;
    color: #444;
  }
}

.grid-content {
  background-color: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 12px #e9e9e9;

  .grid-content__box {
    padding: 16px 20px;

    .grid-content__title {
      padding-bottom: 12px;
      font-size: 16px;
      font-weight: 600;
      color: #333333;
    }

    .grid-item {
      text-align: center;
      font-size: 14px;
      padding: 20px 6px;
    }

    .grid-title {
      margin-top: 14px;
      font-size: 14px;
      color: #555;
    }

    .grid-content__tip {
      padding: 0 14px;
    }
  }
}

.tip__num {
  font-size: 28px;
  padding: 12px 0;
  color: #369aff;
  font-weight: 500;
}

.tip__title {
  font-size: 16px;
  font-weight: 600;
  color: #333333;
  margin-top: 12px;
}
</style>